import * as actionTypes from '../constants'
import ajax from '../../service/ajax'

// 处理当前左边菜单的选项
export const selectNavAction = (currentNav) => ({
  type: actionTypes.CURRENT_LEFT_NAV,
  data: currentNav
})


export const saveCategoryAction = (res) => ({
  type: actionTypes.SAVE_CATEGORY_LIST,
  data: res.data.reverse()
})


// 保存分类信息
export const saveCategoryListAction = () => {
  return dispatch => {
    ajax.get('/manage/category/list').then(res => {
      dispatch(saveCategoryAction(res))
    })
  }
}









